package com.xugui.learn.order.pojo.request;

import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * 订单请求参数
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderRequest {
    /**
     * 用户 ID
     */
    @NotNull(message = "用户ID不能为空")
    private Long userId;

    /**
     * 订单项列表
     */
    @Valid  // 嵌套校验
    @NotEmpty(message = "订单项不能为空")
    private List<OrderItemRequest> items;
}
